package servlet;

import bean.City;
import com.alibaba.fastjson.JSON;
import dao.BaseDao;
import service.CityService;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@WebServlet("/city")
public class CityServlet extends BaseServlet {
    private CityService cs=new CityService();
    public void findAllCityByPid(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pid = req.getParameter("pid");
        List<City> list = cs.findAllCityByPid(Integer.parseInt(pid));
        String s = JSON.toJSONString(list);
        resp.getWriter().print(s);


    }
}
